package com.song.email.core;

import java.util.List;
import java.util.Vector;

import com.song.email.util.common.Config;
import com.song.email.util.common.Counter;
import com.song.email.util.common.FileUtil;

public class MailtoCenter {
	private static MailtoCenter mailtoCenter = null;
	private Vector<String> mailtoList = new Vector<String>();
	
	private MailtoCenter(){}
	
	public synchronized static MailtoCenter getInstance(){
		if(null == mailtoCenter){
			mailtoCenter = new MailtoCenter();
		}
		return mailtoCenter;
	}
	
	public void init(){
		String filePath = MailtoCenter.class.getResource("/" + Config.mailtoList).getPath();
		List<String> list = FileUtil.readFile2List(filePath);
		mailtoList = new Vector<String>(list);
		if(mailtoList != null){
			Counter.sumWorkCount += mailtoList.size();
		}
	}

	public synchronized Vector<String> getMailtoList() {
		return mailtoList;
	}
	
	public synchronized int getMailtoListSize(){
		return mailtoList.size();
	}
}
